<form id="pagerForm" method="post" action="">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
</form>
<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post">
		<input type="hidden" name="g" value="{$group_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
	<div class="searchBar">
		<table class="searchContent">
			<tr>
				<td>
					关键字：<input type="text" class="autoinput" name="keywords" value="{$keywords}"/>
					<input type="hidden" name="sfield_name" value="name,alias" />
				</td>
				<td><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></td>
			</tr>
		</table>
	</div>
	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="{:U('Brand/add')}" rel="Brand_add" target="dialog" width="450" height="280"><span>添加</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="113">
		<thead>
			<tr>
				<th width="5"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th width="10" orderField="id" {if $orderField=='id'}class="{$orderDirection}"{/if}>品牌ID</th>
				<th width="20" orderField="name" {if $orderField=='name'}class="{$orderDirection}"{/if}>品牌名称</th>
				<th width="20" orderField="alias" {if $orderField=='alias'}class="{$orderDirection}"{/if}>品牌别名</th>
				<th width="30" orderField="status" {if $orderField=='status'}class="{$orderDirection}"{/if}>状态</th>
				<th width="10" orderField="status" {if $orderField=='is_top'}class="{$orderDirection}"{/if}>是否推荐</th>
				<th width="20" orderField="status" {if $orderField=='sequence'}class="{$orderDirection}"{/if}>排序</th>
				<th width="45"  >上架/下架产品</th>
				<th width="60" orderField="write_uid" {if $orderField=='write_uid'}class="{$orderDirection}"{/if}>修改人</th>
				<th width="80" orderField="write_date" {if $orderField=='write_date'}class="{$orderDirection}"{/if}>修改时间</th>
				<th width="60" orderField="create_uid" {if $orderField=='create_uid'}class="{$orderDirection}"{/if}>创建人</th>
				<th width="60" align="center" orderField="create_date" {if $orderField=='create_date'}class="{$orderDirection}"{/if}>创建时间</th>
				<th width="60" align="center">操作</th>
			</tr>
		</thead>
		
		<tbody>
		<volist name='list' id='b'>
			<tr target="sid_user">
				<td><input name="ids" value="{$b['id']}" type="checkbox"></td>
				<td>{$b['id']}</td>
				<td>{$b['name']}</td>
				<td>{$b['alias']}</td>
				<td>{$status[$b['status']]}</td>
				<td><button onclick="ajax_status2({$b['id']},this)">{if $b['is_top']==2}已推荐{else}未推荐{/if}</button></td>
				<td><input value="{$b['sequence']}" size="5" class="ss" onblur="updatesequence(this,{$b['id']});"></td>
				<td>{if $brandp[$b['id']]['sj']}{$brandp[$b['id']]['sj']}{else}0{/if}/{if $brandp[$b['id']]['xj']}{$brandp[$b['id']]['xj']}{else}0{/if}</td>
				<td>{$b['write_uid']}</td>
				<td>{if $b['write_date']}{$b['create_date']|date='Y-m-d',###}{else}---{/if}</td>
				<td>{$b['create_uid']}</td>
				<td>{if $b['write_date']}{$b['write_date']|date='Y-m-d',###}{else}---{/if}</td>
				<td>
					<a title="编辑" href="{:U('Brand/edit',array('id'=>$b['id']))}" target="dialog" width="450" height="280" rel=“Brand_edit" class="btnEdit">编辑</a>
					<a title="确实要删除这条记录吗?" href="{:U('Brand/del',array('id'=>$b['id']))}" class="btnDel" target="ajaxTodo" title="确定要删除吗?">删除</a>
				</td>
			</tr>
		</volist>
		</tbody>
	</table>
<include file="Index:pages" />
</div>
<script type="text/javascript">
function ajax_status2(id,obj){
	var str = $(obj).html();
	var status = (str=='已推荐') ? 1 : 2;
	$.ajax({
		type: 'GET',
		url: "{:U('Site/ajax_doen')}",
		data: 'mod=product_brand&type=update&id='+id+'&status='+status+'&fstatus=is_top',
		success: function(msg){
			if ( str == '未推荐' ) $(obj).html('已推荐');
			if ( str == '已推荐' ) $(obj).html('未推荐');
			
		}
	});
}

function updatesequence(obj,id){
	//alert( $(obj).val()+id );
	var o = $(obj);
	$.ajax({
		type:"POST",
		url: "/index.php?s=Site-ajax_doen",
		data: 'mod=product_brand&type=update&fstatus=sequence&status='+o.val()+'&id='+id,
		timeout:"7000",
		dataType:"JSON",
		success: function(msg){}
	});
}
</script>